package com.briup.day07;

import java.util.Scanner;

public class KingTower {
	
	public static void method1(int height){
        for(int i=1;i<=height;i++){
            for(int j=1;j<=i;j++){
                System.out.print("*");
            }
            System.out.println();
        }
    }
	
	public static void method2(){
        for(int i=1;i<=7;i++){
        	for(int k=1; k <= 7-i;k++ ) {
        		System.out.print(" ");
        	}
            for(int j=1;j<=i;j++){
                System.out.print("*");
            }
            System.out.println();
        }
    }

	public static void method3(){             //method2扩展
        for(int i=1;i<=7;i++){
            for(int j=1;j<=7;j++){
            	if(j <= 7-i) {
            		System.out.print(" ");
            	}else {
            		System.out.print("*");
            	}
            }
            System.out.println();
        }
    }
	
	public static void method4(int height){
        for(int i=1;i<=height;i++){
            for(int j=1;j<=height-i;j++){
                System.out.print("*");
            }
            System.out.println();
        }
    }
	
	
	public static void method5(){             //method4扩展
        for(int i=1;i<=7;i++){
            for(int j=1;j<=7;j++){
            	if(j <= 7-i) {
            		System.out.print("*");
            	}
            }
            System.out.println();
        }
    }
	
	public static void method6(){             
        for(int i=1;i<=7;i++){
            for(int j=1;j<i;j++){
            	System.out.print(" ");	
            }
            for(int k=0; k<=7-i; k++) {
            	System.out.print("*");
            	
            }
            System.out.println();
        }
    }
	
	public static void method7(){             
        for(int i=1;i<=7;i++){
            for(int j=1;j<7-i;j++){
            	System.out.print(" ");	
            }
            for(int k=1; k<=2*i-1; k++) {
            	System.out.print("*");
            	
            }
            System.out.println();
        }
    }
	
	public static void method8(){             
        for(int i=1;i<=7;i++){
            for(int j=1;j<=2*(i-1);j++){
            	System.out.print(" ");	
            }                                 
            for(int k=1; k<=(6-i)*4+1; k++) {
            	System.out.print("*");
            	
            }
            System.out.println();
        }
    }
	
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.println("请选择您所想输出的金字塔形式1-8");
		Scanner sc = new  Scanner(System.in);
		int number = sc.nextInt();
		switch (number) {
		case 1:
			method1(7);
			break;
		case 2:
			method2();
			break;
		case 3:
			method3();
			break;
		case 4:
			method4(7);
			break;
		case 5:
			method5();
			break;
		case 6:
		    method6();
			break;
		case 7:
		    method7();
			break;
		case 8:
		   method8();
			break;
		default:
			System.out.println("输入格式有误，请重新输入!");
			break;
		}
		
	}

}
